package gs.es.plugin.safe;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.logging.ESLoggerFactory;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.*;

/**
 * Created by eviltuzki on 17-1-19.
 */
public class SafePluginHandler extends BaseRestHandler {
    @Inject
    public SafePluginHandler(Settings settings, RestController controller, Client client) {
        super(settings, controller, client);
        RestFilter filter = new SafeFilter();
        controller.registerFilter(filter);
    }

    @Override
    protected void handleRequest(RestRequest restRequest, RestChannel restChannel, Client client) throws Exception {
        ESLogger logger = ESLoggerFactory.getRootLogger();
        logger.error(restRequest.getLocalAddress().toString());
    }
}
